﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


using BASE;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Utils.getStringSession("masv") != "")
        {
            tb_dn.Visible = false;
        }
        if (!IsPostBack)
        {
            busTin busT = new busTin();
            re_ttqt.DataSource = busT.getTinByLoaiTinId(1);
            re_ttqt.DataBind();
            re_ttch.DataSource = busT.getTinByLoaiTinId(2);
            re_ttch.DataBind();
        }
        Session["menu"] = Constants.TRANGCHU;
    }
    protected void btn_dn_Click(object sender, EventArgs e)
    {
        entSinhVien entSV = new entSinhVien();
        entSV.MaSinhVien = txt_msv.Text;
        entSV.MatKhau = txt_mk.Text;
        busSinhVien busSV = new busSinhVien();
        List<entSinhVien> lst = new List<entSinhVien>();
        lst=busSV.getSinhVienDangNhap(entSV);
        if (lst.Count > 0)
        {
            Session["masv"] = lst[0].MaSinhVien;
            Session["ten"] = lst[0].Ten;
            Session["malop"] = lst[0].MaLop;
            Response.Redirect("default.aspx");
            tb_dn.Visible = false;
        }
    }
}